package com.icity.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import com.icity.entity.Application;
import com.icity.entity.EquipmentDistribution;
import com.icity.entity.EquipmentSummary;
import com.icity.entity.PartnerMsg;
import com.icity.entity.ProductType;
import com.icity.entity.RegisteredUse;
import com.icity.entity.ResourceDistribution;
import com.icity.entity.ScreenAccess;
import com.icity.entity.ScreenTraffic;
import com.icity.entity.StatisticalSummary;
import com.icity.entity.journalBookReadBorrow;
import com.icity.entity.journalBookStatistical;

/**
 * 大屏统计——设备
 * @author apple
 */
@Mapper
public interface EquipmentSummaryMapper {


	@Select("select unique_code,equipment_num,equipment_instance_num,service_expire_equipment_num from tbl_icity_equipment_summary where partner_id=#{partner_id}")	
	List<EquipmentSummary> getAllEquimentSummary(Map<Object, Object> map);
    @Select("select unique_code,screen_name,installed_equipment_num,percentage from tbl_icity_product_type where partner_id=#{partner_id} ")
	List<ProductType> getProductTypeOverview(Map<Object, Object> map);
    @Select("select service_name,resources_package_unique_code,resources_package_journal_num,resources_package_book_num,application_announce_ment_num,application_article_num,application_video_num,application_bananer_num,application_equipment from tbl_icity_screen_access where resources_package_unique_code=#{resources_package_unique_code} and partner_id=#{partner_id}")
	List<ScreenAccess> getAllScreenAnalysis(Map<Object, Object> map);
    
    
    @Select(
			"<script>"
					+"select service_name,resources_package_unique_code,journal_traffic,book_traffic,announce_ment_traffic,article_traffic,video_traffic,bananer_traffic,audio_traffic from tbl_icity_screen_traffic where 1=1"
					+ "<if test='service_name != null'>"
					+ " and service_name like CONCAT('%','${service_name}','%' ) "
					+ "</if>"
					+ "<if test='partner_id != null'>"
					+ " and partner_id #{partner_id}"
					+ "</if>"
					+ "<if test='service_unique_code != null'>"
					+ " and service_unique_code #{service_unique_code}"
					+ "</if>"			
					+ "and create_time BETWEEN statrt_time=#{statrt_time} and end_time=#{end_time} "					
					+ " </script>"
			)
	List<ScreenTraffic> getAllScreenAnalysisPie(Map<Object, Object> map);
	
}
